import http from "@/api";
import {
  CreateMenuParam,
  EditMenuInfoParam,
  EditMenuStatusParam,
  GetMenuListParam,
  MenuTreeResult
} from "@/api/interface/auth/menu";

const apiName = "MenuManager";

/** 新增菜单 */
export const createMenu = (param: CreateMenuParam) => {
  return http.post<string>(`${apiName}/CreateMenu`, param);
};

/** 获取树形菜单 */
export const getMenuTree = () => {
  return http.post<MenuTreeResult[]>(`${apiName}/GetMenuTree`);
};

/** 获取菜单列表 */
export const getMenuList = (param: GetMenuListParam) => {
  return http.post<MenuTreeResult[]>(`${apiName}/GetMenuList`, param);
};

/** 修改菜单信息 */
export const editMenuInfo = (param: EditMenuInfoParam) => {
  return http.post<string>(`${apiName}/EditMenuInfo`, param);
};

/** 修改菜单状态 */
export const editMenuStatus = (param: EditMenuStatusParam) => {
  return http.post<string>(`${apiName}/EditMenuStatus`, param);
};
